﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void botton1_Click(object sender, EventArgs e)
        {
            String text = textBox1.Text;
            String[] A = text.Split(',');
            int[] B;
            B = new int[A.Length];
            String[] C;
            string output="";
            for (int i = 0; i < A.Length; i++)
            {
                int b = 0;
                int.TryParse(A[i], out b);
                B[i] = b;
            }
            C = new string[B[1] - B[0] + 1];
            int k=0;
            for (int i = B[0]; i < B[1]; i++)
              
            {
                bool flag = true;
                for (int j = 2; j < i ; j++)
                {
                    
                    if (i % j == 0) flag = false;
                }
                if (flag)
                {
                    C[k] = i.ToString();
                    k++;
                }
            }
            for(int i = 0; i < k + 1; i++)
            {
                if (i%10==9)
                {
                    output = output + "\r\n";
                    
                }
                output = output + C[i] + ' ';
            }
            MessageBox.Show(output);
        }
    }
}
